<template>
  <div class="container">
    <el-form :model="searchList" ref="searchList">
      <el-row :gutter="20">
        <el-col :span="9" :offset="0">
          <div class="left">
            <el-button type="primary" size="medium" @click="search" :loading="loading">查询</el-button>
            <el-button type="primary" size="medium" @click="expExcel" :loading="loading">导出</el-button>
          </div>
        </el-col>
      </el-row>
    </el-form>
    <el-table :data="tableData" border stripe :height="offsetHeight" v-loading="loading">
      <el-table-column type="index" label="序号" width="50" align="center">
      </el-table-column>

      <el-table-column prop="title2" label="保障部门/内设部门名称" min-width="300" align="center">
      </el-table-column>
      <el-table-column prop="title3" label="未审批项目数量" width="300" align="center">
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import ProjectItem from '@/components/Project'
import RejectItem from '@/components/Reject'
import Verify from './components/verify'
import { d_buildType } from '@/utils/dicts.js'
import { f_buildType } from '@/utils/filters.js'
export default {
  name: 'UnitNoFinish',
  components: {
    ProjectItem, Verify, RejectItem
  },
  props: {
    switch: {
      type: Boolean,
      default: () => {
        return false
      }
    },
    status: {
      type: String,
      default: () => {
        return ''
      }
    },
  },
  data () {
    return {
      offsetHeight: document.documentElement.clientHeight - 300,
      searchList: {},
      loading: false,
      loading: false,
      tableData: [],
      titleData: {},
      rejectShow: false,
      rejectParams: {},
      projectShow: false,
      projectParams: {},
      d_buildType: d_buildType,
      verifyShow: false,
      verifyParams: {}
    }
  },
  created () {

  },
  mounted () {
    this.init()
  },
  methods: {
    async init () {
      const res = await this.$http('findWholeList', {
        status: this.status
      })
      this.titleData = res
      this.loading = true
      const res1 = await this.$http('noFinishCountList', {
        del_flag: '0',
        ...this.searchList
      })
      this.tableData = res1
      this.loading = false
    },
    search () {
      this.loading = true
      this.init()
      this.loading = false
    },
    cancel () {
      this.projectShow = false
      this.projectParams = {}
      this.verifyShow = false
      this.verifyParams = {}
    },
    rejection (id) {
      this.rejectShow = true
      this.rejectParams = {
        id: id,
        status: '2',
      }
    },
    expExcel () {
      window.open('/api/ac/maintain/infoProjectService/exportNoFinishData');
    },
    projectInfo (pid) {
      this.projectShow = true
      this.projectParams = {
        pid: pid,
      }
    },
    contractInfo (item) {
      sessionStorage.setItem("inputInfo",
        JSON.stringify({
          switch: this.switch,
          pid: item.id,
          pcode: item.project_code,
          pname: item.project_name,
          path: 'noFinish'
        })
      );
      this.$router.push({
        path: './unit/contract',
      })
    },
    advice (item) {
      this.verifyParams = {
        id: item.id,
        status: item.status,
        apply_batch: item.apply_batch,
        internal_code_log: item.internal_code_log
      }
      this.verifyShow = true
    },
  },
  computed: {

  },
  filters: {
    f_buildType: f_buildType
  }
}
</script>
<style scoped>
</style>
